<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      font-size: 20px;
    }
  </style>
</head>
<body>

  <div class="box" style="background-color: red;">
    我是box
  </div>
  
  <script>

    var boxEl = document.querySelector(".box")
    console.log(boxEl.style.backgroundColor)
    // console.log(boxEl.style.fontSize)

    console.log(getComputedStyle(boxEl).fontSize)

  </script>

</body>
</html>